﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace KlageSystem
{
    public partial class Login : System.Web.UI.Page
    {
        Dictionary<string, string> users = new Dictionary<string,string>();

        protected void Page_Load(object sender, EventArgs e)
        {
            users.Add("Henrik", "DEF2esy4u");
            users.Add("Peter", "F24q8");
            users.Add("Henning", "2esy4u");
            users.Add("Kamilla", "2esy4u");
            users.Add("Administrator", "Capacent2esy4u");
            txtUsername.Focus();
            txtError.Visible = false;
        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (!users.ContainsKey(txtUsername.Text) || users[txtUsername.Text] != txtPassword.Text )
            {
                txtError.Text = "Ugyldigt brugernavn eller password";
                txtError.Visible = true;
                txtUsername.Text = "";
                txtPassword.Text = "";
                return;
            }
            Session.Remove("user");
            Session.Add("user",txtUsername.Text);
            Response.Redirect("~/Default.aspx");

        }
    }
}